Replace a fragment
Given the following starting code:
FragmentManager fm = getSupportFragmentManager(); Fragment frag = new BodyPartFragment(); int containerID = R.id.fragment_container; FragmentTransaction ft = fm.beginTransaction();
Complete the transaction code to replace the fragment container with a new BodyPartFragment.
ft.replace(containerID, frag);
ft.add(containerID, frag). commit();
ft.replace(containerID, null). commit();
ft.replace(containerID, frag). commit();
Next Concept